package com.cheyun.netsalev3.widget

import android.content.Context
import android.graphics.*
import android.util.AttributeSet
import android.util.TypedValue
import android.view.View


/**
 * 竖虚线
 */
class XunXinView :View{
    constructor(context: Context) : super(context)
    constructor(context: Context, attrs: AttributeSet) : super(context, attrs){
        initView()
    }

    private lateinit var pain: Paint

    private lateinit var mPath: Path

    private fun initView() {
        pain=Paint()
        pain.color=Color.parseColor("#ffd4d8e1")
        pain.isAntiAlias=true
        pain.strokeWidth = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,1.2f,context.resources.displayMetrics)
        pain.style = Paint.Style.STROKE
        pain.pathEffect = DashPathEffect(floatArrayOf(10f, 6f), 0f)
        mPath = Path()

    }

    override fun draw(canvas: Canvas?) {
        super.draw(canvas)
        var startX= measuredWidth/2f
        mPath.reset()
        mPath.moveTo(startX, 0f)
        mPath.lineTo(startX, measuredHeight.toFloat())
        canvas?.drawPath(mPath, pain)
    }
}